/*
 * MessageInfo.cpp
 *
 *  Created on: Nov 2, 2013
 *      Author: vladimir
 */

#include "MessageInfo.hpp"

#include <type_traits>
#include <algorithm>

namespace mq
{

static_assert( MAX_MESSAGE_SIZE == sizeof( MessageInfo ), "check the size of MessageInfo" );
static_assert( std::is_standard_layout<MessageInfo>::value, "has to have standard layout" );

MessageInfo::MessageInfo() :
		id( 0 ),
		buffer()
{
	buffer.fill( 0 );
}

void MessageInfo::UpdateMessageToSend(
		const unsigned int id_,
		const char* data,
		const unsigned int size )
{
	id = id_;
	std::copy_n( data, size, buffer.begin() );
}

} /* namespace mq */

